package dao;

import java.sql.CallableStatement;
import java.sql.SQLException;

import util.dataUtil;

import model.userModel;

public class logindao {
	public static int login(userModel model) {
		int result = 0;
		try {
			CallableStatement csmt = dataUtil.getconnConnection().prepareCall("{call sp_Login(?,?,?)}");
			csmt.setString("USERNAME", model.getUserName());
			csmt.setString("PASSWORD", model.getPassWprd());
			csmt.registerOutParameter("RESULT", java.sql.Types.INTEGER);
			csmt.execute();
			result = csmt.getInt("RESULT");
		} catch (SQLException e) {
			result = 0;
		}
		return result;
	}
}
